<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html;charset=utf-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>订单</title>
		<link rel="stylesheet"href="../css/dingdan.css"type="text/css">
	</head>
	<body>
		<table class="table-head table-mod">
			<tbody>
				<tr>
					<th width="331px">宝贝</th>
					<th>单价</th>
					<th>数量</th>
					<th>实付款</th>
					<th>交易状态</th>
				</tr>
			</tbody>
		</table>
		<c:forEach items="${orderList}" var="order">
		<div class="dom">
			<label>
				<span class="time">
					<input type="checkbox"/>
					<span class="time"><fmt:formatDate value="${order.ordertime}" pattern="yyyy-MM-dd"/> </span>
				</span>
				<span>
					<span>订单号</span>
					<span>:</span>
					<span>${order.id}</span>
				</span>
			</label>
		</div>
		<table class="tb">
			<c:forEach items="${order.orderItemList}" var="orderItem" varStatus="oi">
			<tr>
				<td width="330px">
					<div style="display: block;">
						<img src="${pageContext.request.contextPath}/productImages/${orderItem.product.product_image}" style="float: left;width: 50px"/>
						<p style="width: 230px; margin-left:10px; float: left;">
							<a href="${pageContext.request.contextPath}/main/selectById.do?id=${orderItem.product.book_id}"><span class="sp">${orderItem.product.book_name}</span></a>
						</p>
					</div>
				</td>
				<td width="238px" align="center">
					<div>
						<p>${orderItem.price}</p>
					</div>
				</td>
				<td width="238px" align="center">${orderItem.count}</td>
				<c:if test="${oi.index == 0}">
				<td class="boder" rowspan="${order.orderItemList.size()}">${order.goodprice}</td>
				<td class="boder" width="239px" rowspan="${order.orderItemList.size()}">
					<c:if test="${order.orderstate == 1}">
						<div>
							<p>交易成功</p>
							<p>订单详情</p>
						</div>
					</c:if>
					<c:if test="${order.orderstate == 0}">
						<div>
							<p>未支付</p>
							<a href="/zhifubao/alipay.trade.page.pay.jsp?WIDout_trade_no=${order.id}&WIDsubject=购书&WIDtotal_amount=${order.goodprice}&WIDbody=1"><p>前去支付</p></a>
						</div>
					</c:if>
				</td>
				</c:if>
			</tr>
			</c:forEach>
		</table>
		</c:forEach>
		
		<div style="margin: 50px;text-align: center;">
				<a href="javascript:history.go(-1);">
				<input 	class="button_1"  type="button" value="取消" /></a>  
	    </div>
	</body>
</html>